﻿
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////
#include "IModelView.h"
#include "ModelViewEnums.h"
#include "IParameterValueInt.h"
#include "IParameterValueList.h"
#include "IParameterDefinitionLibrary.h"
#include "IParameterValueDisplayString.h"
#include "GbmpBuiltInParameterDefinitions.h"

#include "ParameterDisplayManager.h"
#include "BuiltInParameterDisplayCreator.h"
#include "IBuiltInParameterDisplayCreator.h"
#include "EnableCompileWarning_The_LAST_IncludeInCpp.h"

namespace Sample 
{
    namespace BuiltInParameterDisplayCreators
    {
        // Element

        ADD_GCMP_DYNAMIC_VALUE_LIST_PARAMETER_DISPLAY(ViewWorkLevelBuiltInParameter, ParameterDocumentLevelList);
        ADD_GCMP_DYNAMIC_VALUE_LIST_PARAMETER_DISPLAY(RoofSlopeArrowTailAssociatedLevelBuiltInParameter, ParameterDocumentLevelList);
        ADD_GCMP_DYNAMIC_VALUE_LIST_PARAMETER_DISPLAY(RoofSlopeArrowHeadAssociatedLevelBuiltInParameter, ParameterDocumentLevelList);

        // ModelView
        ADD_GCMP_DYNAMIC_VALUE_LIST_PARAMETER_DISPLAY(ViewScaleBuiltInParameter, ParameterViewScaleList);

        ADD_GCMP_DYNAMIC_VALUE_LIST_PARAMETER_DISPLAY(FormSubCategoryBuiltInParameter, ParameterSubCategoryList);

        ParameterValueDisplayStrings GetElevationSysmbolValueList()
        {
            ParameterValueDisplayStrings res;
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(1), GBMP_TR(L"上标头"))); // 1 = (int32_t)LevelSymbol::UpperHeader
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(2), GBMP_TR(L"下标头"))); // 2 = (int32_t)LevelSymbol::LowerHeader
            return res;
        }
        ADD_STATIC_VALUE_LIST_PARAMETER_DISPLAY(LevelSymbolBuiltInParameter, GetElevationSysmbolValueList());

        ParameterValueDisplayStrings GetModelViewDisplayModeValueList()
        {
            ParameterValueDisplayStrings res;
            gcmp::ModelViewDisplayOptions displayOptions;

            displayOptions.HasLight = true;
            displayOptions.HasMaterial = true;
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(gcmp::IModelView::ConvertDisplayModeAndOptionsToInt(gcmp::ModelViewDisplayMode::Solid, displayOptions)), GBMP_TR(L"着色：有光照，有材质")));

            displayOptions.HasLight = false;
            displayOptions.HasMaterial = false;
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(gcmp::IModelView::ConvertDisplayModeAndOptionsToInt(gcmp::ModelViewDisplayMode::Solid, displayOptions)), GBMP_TR(L"着色：无光照，无材质")));

            displayOptions.HasLight = true;
            displayOptions.HasMaterial = false;
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(gcmp::IModelView::ConvertDisplayModeAndOptionsToInt(gcmp::ModelViewDisplayMode::Solid, displayOptions)), GBMP_TR(L"着色：有光照，无材质")));

            displayOptions.HasLight = false;
            displayOptions.HasMaterial = true;
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(gcmp::IModelView::ConvertDisplayModeAndOptionsToInt(gcmp::ModelViewDisplayMode::Solid, displayOptions)), GBMP_TR(L"着色：无光照，有材质")));

            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(gcmp::IModelView::ConvertDisplayModeAndOptionsToInt(gcmp::ModelViewDisplayMode::HiddenLine, displayOptions)), GBMP_TR(L"消隐线")));

            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(gcmp::IModelView::ConvertDisplayModeAndOptionsToInt(gcmp::ModelViewDisplayMode::Wireframe, displayOptions)), GBMP_TR(L"线框")));

            return res;
        }
        ADD_STATIC_VALUE_LIST_PARAMETER_DISPLAY(ViewDisplayModeBuiltInParameter, GetModelViewDisplayModeValueList());

        ParameterValueDisplayStrings GetFloorAlignPlaneValueList()
        {
            ParameterValueDisplayStrings res;
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(0), GBMP_TR(L"顶部")));
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(1), GBMP_TR(L"底部")));
            return res;
        }
        ADD_STATIC_VALUE_LIST_PARAMETER_DISPLAY(FloorAlignPlaneBuiltInParameter, GetFloorAlignPlaneValueList());

        ParameterValueDisplayStrings GetModelViewDetailLevelValueList()
        {
            ParameterValueDisplayStrings res;
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(0), GBMP_TR(L"粗略")));
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(1), GBMP_TR(L"中等")));
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(2), GBMP_TR(L"精细")));
            return res;
        }
        ADD_STATIC_VALUE_LIST_PARAMETER_DISPLAY(ModelViewDetailLevelBuiltInParameter, GetModelViewDetailLevelValueList());

        ParameterValueDisplayStrings GetHorizontalAlignmentTypeValueList()
        {
            ParameterValueDisplayStrings res;
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(0), GBMP_TR(L"左")));
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(1), GBMP_TR(L"中")));
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(2), GBMP_TR(L"右")));
            return res;
        }
        ADD_STATIC_VALUE_LIST_PARAMETER_DISPLAY(TextHorizontalAlignmentTypeBuiltInParameter, GetHorizontalAlignmentTypeValueList());

        ParameterValueDisplayStrings GetVerticalAlignmentTypeValueList()
        {
            ParameterValueDisplayStrings res;
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(0), GBMP_TR(L"上")));
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(1), GBMP_TR(L"中")));
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(2), GBMP_TR(L"下")));
            return res;
        }
        ADD_STATIC_VALUE_LIST_PARAMETER_DISPLAY(TextVerticalAlignmentTypeBuiltInParameter, GetVerticalAlignmentTypeValueList());

        ParameterValueDisplayStrings GetLinearArrayModeValueList()
        {
            ParameterValueDisplayStrings res;
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(0), GBMP_TR(L"间隔距离")));
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(1), GBMP_TR(L"整体距离")));
            return res;
        }
        ADD_STATIC_VALUE_LIST_PARAMETER_DISPLAY(LinearArrayModeBuiltInParameter, GetLinearArrayModeValueList());

        ParameterValueDisplayStrings GetRadialArrayModeValueList()
        {
            ParameterValueDisplayStrings res;
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(0), GBMP_TR(L"间隔角度")));
            res.emplace_back(gcmp::IParameterValueDisplayString::CreateParameterValueDisplayString(gcmp::IParameterValueInt::Create(1), GBMP_TR(L"整体角度")));
            return res;
        }
        ADD_STATIC_VALUE_LIST_PARAMETER_DISPLAY(RadialArrayModeBuiltInParameter, GetRadialArrayModeValueList());
     }
}

